﻿using Sidvall.IO;
using System;
using System.Threading.Tasks;

namespace Sidvall.Devices.Uwp
{
    public class StorageFile : IStorageFile
    {
        #region Public Members

        #region DateCreated

        public DateTimeOffset DateCreated
        {
            get
            {
                return this.InternalStorageFile.DateCreated;
            }
        }

        #endregion
        #region Name

        public string Name
        {
            get
            {
                return this.InternalStorageFile.Name;
            }
        }

        #endregion
        #region Path

        public string Path
        {
            get
            {
                return this.InternalStorageFile.Path;
            }
        }

        #endregion

        #region GetImagePropertiesAsync

        public async Task<ImageProperties> GetImagePropertiesAsync()
        {
            var values = await this.InternalStorageFile.Properties.GetImagePropertiesAsync();
            return new ImageProperties()
            {
                DateTaken = values.DateTaken,
                Latitude = values.Latitude,
                Longitude = values.Longitude,
                Title = values.Title,
            };
        }

        #endregion
        #region ToString

        public override string ToString()
        {
            return "StorageFile - UWP";
        }

        #endregion

        #endregion
        #region Private Members

        private Windows.Storage.StorageFile InternalStorageFile { get; set; }

        #endregion
        #region Constructors

        public StorageFile(Windows.Storage.StorageFile storageFile)
        {
            this.InternalStorageFile = storageFile;
        }

        #endregion
    }
}
